//package com.lu.common.exception;
//
//import org.springframework.lang.Nullable;
//import org.springframework.util.ClassUtils;
//import org.springframework.web.bind.annotation.ControllerAdvice;
//import org.springframework.web.bind.annotation.ExceptionHandler;
//import org.springframework.web.method.HandlerMethod;
//import org.springframework.web.servlet.HandlerExceptionResolver;
//import org.springframework.web.servlet.ModelAndView;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.lang.reflect.Method;
//import java.util.HashMap;
//import java.util.Map;
//
//@ControllerAdvice
//public class CommonHandlerExceptionResolver implements HandlerExceptionResolver{
//
////    @ExceptionHandler(value = RuntimeException.class)
////    public ModelAndView defaultErrorHandler(HttpServletRequest req, Exception e) throws Exception {
////        ModelAndView mav = new ModelAndView();
////        mav.addObject("url","http://localhost:63342/SpringBootFramework/templates/start/index.html");
////        mav.setViewName("error11111");
////        System.out.println(req.getRequestURL());
////        System.out.println(e.toString());
////        return mav;
////    }
//
//    @Nullable
//    @Override
//    public ModelAndView resolveException(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, @Nullable Object handler, Exception e) {
//        // 获取action的方法实例(springmvc对当次请求action的封装)
//        HandlerMethod handlerMethod = (HandlerMethod) handler;
//        // 获取method对象
//        Method method = handlerMethod.getMethod();
//        // 如果抛出的不是系统自定义异常则重新构造一个未知错误异常。
//        ModelAndView modelAndView = new ModelAndView();
//        modelAndView.addObject("message", e.getMessage());
//        modelAndView.setViewName("error");
//        return modelAndView;
//    }
//}
